package cn.zynworld.saas.user.web.entity.resp;

import java.io.Serializable;

/**
 * Created by zhaoyuening on 2018/1/21.
 */
public class ResponseVO<T> implements Serializable {
    private T data;
    private boolean success;
    private int status;

    public static <T> ResponseVO<T> SUCCESS(T data){
        return new ResponseVO().setSuccess(true).setStatus(200).setData(data);
    }
    public static <T> ResponseVO<T> FAIL(T data,int status){
        return new ResponseVO().setSuccess(false).setStatus(status).setData(data);
    }
    public static <T> ResponseVO<T> FAIL(){
        return FAIL(null,400);
    }
    public static <T> ResponseVO<T> SUCCESS(){
        return SUCCESS(null);
    }

    public T getData() {
        return data;
    }

    public ResponseVO setData(T data) {
        this.data = data;
        return this;
    }

    public boolean isSuccess() {
        return success;
    }

    public ResponseVO setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    public int getStatus() {
        return status;
    }

    public ResponseVO setStatus(int status) {
        this.status = status;
        return this;
    }
}
